﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <%:Resources.SMSTemplate_Title%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div class="maincontent" id="tabcontent">
        <h2>
            <%:Resources.SMSTemplate_Title%></h2>
        <% using (Ajax.BeginForm("deleteTemplates", "template", new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "template", Confirm =Resources.All_DoubleCheck}, FormMethod.Post))
           {%>
        <div id="datagrid">
            <%  Html.RenderPartial("templateGrid");
            %>
        </div>
        <%  } %>
    </div>
    <div id="cetd" style="">
        <% using (Html.BeginForm("AddTemplates", "template", FormMethod.Post))
           { %>
        <div class="label">
            <%:Resources.SMSTemplate_Title%></div>
        <textarea name="content"></textarea>
        <input name="id" type="hidden" />
        <br />
        <br />
        <input type="submit" name="ok" value="<%:Resources.All_Submit%>" class="button" />
        <input type="button" name="cancle" value="<%:Resources.All_Cancel%>" class="button" onclick="cancles()" />
        <%} %>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
    <link rel="stylesheet" type="text/css" href="<%:Url.Content("~/Content/css/themes/default/easyui.css")%>" />
    <link rel="stylesheet" type="text/css" href="<%:Url.Content("~/Content/css/themes/icon.css")%>" />
    <link href="<%:Url.Content("~/Content/css/icons.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%:Url.Content("~/Content/css/template.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%:Url.Content("~/Content/js/jquery.easyui.js")%>"></script>
    <script src="<%:Url.Content("~/Content/js/jquery.mask.js")%>"></script>
    <script src="<%:Url.Content("~/Content/js/jquery.alcatel.datagrid.js")%>"></script>
    <script type="text/javascript">
        function cancles() { $('#cetd').dialog('close'); }
    </script>
    <script type="text/javascript">
        function adds() {
            $(".maincontent").mask()
            var id = 0;
            $("#cetd").show()
            //信息
            $('#cetd').dialog({
                title: "<%:Resources.SMSTemplate_Create_Edit%>"
            , iconCls: "icon-template"
                //, border: true
            , width: 465
            , height: 310
            , onClose: function () {
                $(".maincontent").unmask()
            }
            }).find("textarea[name='content']").val("");
            $('#cetd').dialog({
                title: "<%:Resources.SMSTemplate_Create_Edit%>"
            , iconCls: "icon-template"
                //, border: true
          , width: 465
            , height: 310
            , onClose: function () {
                $(".maincontent").unmask()
            }
            }).find("input[name='id']").val(id);
        }

        function edit(value) {
            $(".maincontent").mask()
            var $this = $("img.edit#" + value)
            var templates = $this.parent().next().html().replace(/(^\s*)|(\s*$)/g, "")
            var ids = $this.parent().prev().prev().html().replace(/(^\s*)|(\s*$)/g, "")
            $("#cetd").show()
            //信息
            $('#cetd').dialog({
                title: "<%:Resources.SMSTemplate_Create_Edit%>"
            , iconCls: "icon-template"
                //, border: true
              , width: 465
            , height: 310
            , onClose: function () {
                $(".maincontent").unmask()
            }
            }).find("textarea[name='content']").val(templates);
            //隐藏的ID
            $('#cetd').dialog({
                title: "<%:Resources.SMSTemplate_Create_Edit%>"
            , iconCls: "icon-template"
                //, border: true
              , width: 465
            , height: 310
            , onClose: function () {
                $(".maincontent").unmask()
            }
            }).find("input[name='id']").val(ids)
        }

        $(document).ready(function () {
            var $this = $("#templat_CSS")
            $this.addClass("current")
        })
    </script>
</asp:Content>
